home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / files / filesharingon / filesharingon.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  3.2 KB  |  111 lines

  1. /*
  2.     File:        FileSharingOn.h
  3.     
  4.     Description:This snippet demonstrates how to determine whether or not File Sharing is on.
  5.  
  6.     Author:        VMC
  7.  
  8.     Copyright:     Copyright: © 1996-1999 by Apple Computer, Inc.
  9.                 all rights reserved.
  10.     
  11.     Disclaimer:    You may incorporate this sample code into your applications without
  12.                 restriction, though the sample code has been provided "AS IS" and the
  13.                 responsibility for its operation is 100% yours.  However, what you are
  14.                 not permitted to do is to redistribute the source as "DSC Sample Code"
  15.                 after having made changes. If you're going to re-distribute the source,
  16.                 we require that you make it clear in the source that the code was
  17.                 descended from Apple Sample Code, but that you've made changes.
  18.     
  19.     Change History (most recent first):
  20.                 6/25/99    Updated for Metrowerks Codewarror Pro 2.1(KG)
  21.  
  22. */
  23. /*****    #includes    *****/
  24. #include    <QuickDraw.h>
  25. #include    <Fonts.h>
  26. #include    <Menus.h>
  27. #include     <Events.h>
  28. #include    <Gestalt.h>
  29. #include    <Windows.h>
  30. #include    <Dialogs.h>
  31. #include     <Resources.h>
  32. #include    <SegLoad.h>
  33. #include    <ToolUtils.h>
  34. #include    <Types.h>
  35. #include    <AppleEvents.h>
  36. #include    <Files.h>
  37. #include    <ConditionalMacros.h>
  38. #include    <DiskInit.h>
  39. #include    <Devices.h>
  40.  
  41.  
  42. /*****    #defines    *****/
  43. #define     NIL                    0L            /*  could also be written  "0x00000000"        */
  44. #define        UNIMPLEMENTED         0xA89F        /* A-trap code for unimplemented function     */
  45. #define        WAITNEXTEVENT        0xA860        /* A-trap code for WaitNextEvent()             */
  46.  
  47. /*    kExtremeNeg and kExtremePos are used to set up wide open rectangles and regions. */
  48. #define kExtremeNeg                -32700
  49. #define kExtremePos                32700
  50.  
  51.  
  52. #define        WINDOWID            2000
  53. #define        PUTINFRONT            (WindowPtr) -1L
  54.  
  55. #define        ABOUTID                5000
  56.  
  57. #define        APPLEMENU            5001
  58. #define            appleABOUT        1
  59. #define        FILEMENU            5002
  60. #define            fileQUIT        1
  61. #define        EDITMENU            5003
  62. #define            editUNDO        1
  63.             /* ---------- */
  64. #define            editCUT            3
  65. #define            editCOPY        4
  66. #define            editPASTE        5
  67. #define            editCLEAR        6
  68. #define            editSELECTALL    7
  69.  
  70. #define        TESTMENU                5004
  71. #define            testDOTHETEST        1
  72.  
  73. #define        MAXMENUS            4
  74. #define        FIRSTMENUID            5001
  75.  
  76. #define        TESTALERTID            6000
  77. #define        BADSYSTEMID            6001
  78. #define        BADQUICKDRAWID        6002
  79. #define        NOAPPLEEVENTS        6003
  80.  
  81.  
  82. // Handy macros
  83. #define TopLeft(aRect)    (* (Point *) &(aRect).top)
  84. #define BotRight(aRect)    (* (Point *) &(aRect).bottom)
  85. /*****     Prototypes      *****/
  86. void        main(void);
  87. void         initApp(void);
  88. Boolean        checkGestaltFeatures(void);
  89. Boolean     installAEHandlers();
  90. void         setUpMenus(void);
  91. void         setUpWindow(void);
  92. void         setUpMenus(void);
  93. void         doHighLevel(EventRecord *eventRec);
  94. void         doMousedown(EventRecord *eventRec);
  95. void         doKey(EventRecord *eventRec);
  96. void        doUpdate(EventRecord *eventRec);
  97. void         dispatch(long menuResult);
  98. void         doAppleCmds (short theItem);
  99. void         doFileCmds (short theItem);
  100. void         doTestCmds (short theItem);
  101. void         theTest(void);
  102. Boolean     sharingIsOn(void);
  103. Boolean     volIsSharable(short vRefNum);
  104.  
  105.  
  106.  
  107. pascal OSErr    DoOpenAppAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
  108. pascal OSErr    DoOpenDocAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
  109. pascal OSErr    DoPrintDocAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
  110. pascal OSErr    DoQuitAppAE(AppleEvent theAppleEvent, AppleEvent reply, long refCon);
  111.